﻿using GSOrganization.Application;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;
using System.Security.Claims;

namespace Furion.Web.Entry.Controllers;

public class BaseController : Controller
{
    public string UserId
    {
        get
        {
            var user = Furion.App.User.FindFirstValue(ClaimTypes.Sid);
            return user;
        }
    }
    public MyCurrentUser CurrUser
    {
        get
        {
          
           // var sd=  App.User?.FindFirstValue("UserId");
            var user = Furion.App.User.FindFirstValue(ClaimTypes.UserData);
            if (!string.IsNullOrWhiteSpace(user))
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<MyCurrentUser>(user);
            }
            else
            {
                return null;
            }
        }
    }


}

